// eslint-disable-next-line @typescript-eslint/no-var-requires
const path = require("path");
// eslint-disable-next-line @typescript-eslint/no-var-requires
const pkg = require("../../package.json");
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { parseAndWrite } = require("./lib/index.js");
const rootPath = path.resolve(__dirname, "../../");

parseAndWrite({
  version: pkg.version,
  name: "nf-ui",
  path: path.resolve(rootPath, "./packages/components"),
  typingsPath: path.resolve(rootPath, "./typings/global.d.ts"),
  // default match lang
  test: /zh-CN\.md/,
  outputDir: path.resolve(rootPath, "./nf-ui"),
  tagPrefix: "nf-",
})
  .then((result) => {
    // eslint-disable-next-line no-console
    console.log(`generator types success: ${result} tags generated`);
  })
  .catch((error) => {
    console.error("generator types error", error);
    return Promise.reject(error);
  });
